<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>SAMSUNG后台管理</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="../x-admin/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="../x-admin/css/font.css">
	<link rel="stylesheet" href="../x-admin/css/xadmin.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/Swiper/3.4.2/css/swiper.min.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="https://cdn.bootcss.com/Swiper/3.4.2/js/swiper.jquery.min.js"></script>
    <script src="../x-admin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../x-admin/js/xadmin.js"></script>

</head>
<body>
    <div class="login-logo"><h1>SAMSUNG MANAGEMENT</h1></div>
    <div class="login-box">
        <form class="layui-form layui-form-pane" action="/htlogin" id="myform">
            <input type="hidden" name="v" value="selectByLogin">
            <h3>登录你的帐号</h3>
            <label class="login-title" for="username">帐号</label>
            <div class="layui-form-item">
                 <label class="layui-form-label login-form"><i class="iconfont">&#xe6b8;</i></label>
                <div class="layui-input-inline login-inline">
                  <input type="text" name="username" lay-verify="required" placeholder="请输入你的帐号" autocomplete="off" class="layui-input">
                </div>
            </div>
            <label class="login-title" for="password">密码</label>
            <div class="layui-form-item">
                <label class="layui-form-label login-form"><i class="iconfont">&#xe82b;</i></label>
                <div class="layui-input-inline login-inline">
                  <input type="password" name="password" lay-verify="required" placeholder="请输入你的密码" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="form-actions">
                <input  class="btn btn-warning pull-right" lay-submit lay-filter="login" onclick="Entry()" type="button" value="登录">
            </div>
        </form>
    </div>
	<div class="bg-changer">
        <div class="swiper-container changer-list">
            <div class="swiper-wrapper">
                <div class="swiper-slide"><img class="item" src="/x-admin/images/a.jpg" alt=""></div>
                <div class="swiper-slide"><img class="item" src="/x-admin/images/b.jpg" alt=""></div>
                <div class="swiper-slide"><img class="item" src="/x-admin/images/c.jpg" alt=""></div>
                <div class="swiper-slide"><img class="item" src="/x-admin/images/d.jpg" alt=""></div>
                <div class="swiper-slide"><img class="item" src="/x-admin/images/e.jpg" alt=""></div>
                <div class="swiper-slide"><img class="item" src="/x-admin/images/f.jpg" alt=""></div>
                <div class="swiper-slide"><img class="item" src="/x-admin/images/g.jpg" alt=""></div>
                <div class="swiper-slide"><img class="item" src="/x-admin/images/h.jpg" alt=""></div>
                <div class="swiper-slide"><img class="item" src="/x-admin/images/i.jpg" alt=""></div>
                <div class="swiper-slide"><img class="item" src="/x-admin/images/j.jpg" alt=""></div>
                <div class="swiper-slide"><img class="item" src="/x-admin/images/k.jpg" alt=""></div>
                <div class="swiper-slide"><span class="reset">初始化</span></div>
            </div>
        </div>
        <div class="bg-out"></div>
        <div id="changer-set"><i class="iconfont">&#xe696;</i></div>   
    </div>
    <script>
        function Entry(){
            let formData = new FormData(document.querySelector("#myform"));
            $.ajax({
                url: "/htlogin",
                type: "post",
                data:{
                    "v":"selectByLogin",
                    username:formData.get("username"),
                    password:formData.get("password")
                },
                success: (r => {
                    if (r == -1) {
                        location.href="/htlogin";
                    } else if(r==-2){
                        location.href="/htlogin";
                    }else{
                        //正确，跳转到首页
                        location.href="/htindex";
                    }


                })
            })

        }

        // $(function  () {
        //     layui.use('form', function(){
        //       var form = layui.form();
        //       //监听提交
        //       form.on('submit(login)', function(data){
        //         layer.msg(JSON.stringify(data.field),function(){
        //             location.href='index.html'
        //         });
        //         return false;
        //       });
        //     });
        // })
        
    </script>
    <script>
    // //百度统计可去掉
    // var _hmt = _hmt || [];
    // (function() {
    //   var hm = document.createElement("script");
    //   hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    //   var s = document.getElementsByTagName("script")[0];
    //   s.parentNode.insertBefore(hm, s);
    // })();
    </script>
</body>
</html>